package main

import (
	"io/ioutil"
	"log"
	"net/http"
)

var (
	start = "http://coolshell.cn/"
)

func Run() error {
	resp, err := http.Get(start)
	if nil != err {
		log.Println(err)
		return err
	}
	defer resp.Body.Close()

	if resp.StatusCode != http.StatusOK {
		log.Println(resp.Status)
		log.Println(resp)
		//return nil
	}

	buf, err := ioutil.ReadAll(resp.Body)
	if nil != err {
		log.Println(err)
		return err
	}

	db[resp.Request.URL.String()] = string(buf)
	log.Println(db)

	return nil
}
